<?php
	 $user = $controller->getCurrentUser();    
	//on verifie les permissions
	if ($user->isAllowedTo(GRADE_MOD_BOOK))
	{
		if ($request->getParam('postById'))
		{
			$id = $request->getParam('bookId');
			$book = book::singleton($id, 'id');
		}
		else
		{
			$cotation = $controller->getVar('cotation');
			$book = book::singleton($cotation, 'cotation');
		}
		
		if (!$book->getId())
		{
			$controller->addError('Album non trouv&eacute; !');
			$controller->forward('changeBook');
		}	
		else
		{
			$publishersList = publisher::getList();
			$seriesList = serie::getList();
			$authorsList = author::getList();
			$authorsBook = author::getAuthorsByBook($book->getId());
		
			$controller->setVar('publishersList',$publishersList);
			$controller->setVar('seriesList',$seriesList);
			$controller->setVar('authorsList',$authorsList);
			$controller->setVar('book',$book);
			$controller->setVar('years',generateListYears($book->getYear()));
			$controller->setVar('authorsBook',$authorsBook);
			
			$controller->render('changeBookStep3');
		}
	}
	else
		$controller->render('errorRights');
  
  
?>
